package com.vegetable.modules.entity.outbound.vo;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.vegetable.common.base.BaseEntity;
import com.vegetable.modules.entity.outbound.SalesOrderDetailStock;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 销售出库单
 * </p>
 *
 * @author wangruijie
 * @since 2024-04-01
 */
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="SalesOutDetailVO对象", description="销售总表单")
public class SalesOutDetailVO extends BaseEntity {

    @ApiModelProperty(value = "单据编号")
    private String docNo;

    @ApiModelProperty(value = "批次号")
    private String lotNo;

    @ApiModelProperty(value = "生产者ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long producerId;

    @ApiModelProperty(value = "销售出库表id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long salesId;

    @ApiModelProperty(value = "0水果；1蔬菜")
    private Integer isFruit;

    @ApiModelProperty(value = "商品ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long commodityId;

    @ApiModelProperty(value = "商品编码")
    private String commodityCode;

    @ApiModelProperty(value = "商品名称")
    private String commodityName;

    @ApiModelProperty(value = "规格ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long specsId;

    @ApiModelProperty(value = "规格名称")
    private String specsName;

    @ApiModelProperty(value = "标准")
    private BigDecimal standard;

    @ApiModelProperty(value = "实际数量")
    private Integer number;

    @ApiModelProperty(value = "实际重量")
    private BigDecimal weight;

    @ApiModelProperty(value = "订单总重量")
    private BigDecimal totalWeight;

    @ApiModelProperty(value = "出库数量")
    private Integer outNumber;

    @ApiModelProperty(value = "出库重量")
    private BigDecimal outWeight;

    @ApiModelProperty(value = "模式：0按重，1按件")
    private Integer mode;

    @ApiModelProperty(value = "单价")
    private BigDecimal unitPrice;

    @ApiModelProperty(value = "打包单价")
    private BigDecimal packUnitPrice;

    @ApiModelProperty(value = "成本")
    private BigDecimal cost;

    @ApiModelProperty(value = "单价成本")
    private BigDecimal unitCost;

    @ApiModelProperty(value = "商品金额")
    private BigDecimal goodsMoney;

    @ApiModelProperty(value = "打包金额")
    private BigDecimal packMoney;

    @ApiModelProperty(value = "商品金额+打包")
    private BigDecimal money;

    private BigDecimal totalMoney;

    @ApiModelProperty(value = "利润")
    private BigDecimal profit = BigDecimal.ZERO;

    @ApiModelProperty(value = "利润")
    private BigDecimal totalProfit;

    @ApiModelProperty(value = "包装利润")
    private BigDecimal packProfit = BigDecimal.ZERO;

    @ApiModelProperty(value = "货款利润")
    private BigDecimal goodsProfit = BigDecimal.ZERO;

    @ApiModelProperty(value = "包装/重")
    private BigDecimal costWeight;

    @ApiModelProperty(value = "杂费单价")
    private BigDecimal unitIncidentals;

    @ApiModelProperty(value = "到地费")
    private BigDecimal sumIncidentals;

    @ApiModelProperty(value = "条款单价")
    private BigDecimal clauseUnitPrice;

    @ApiModelProperty(value = "条款金额")
    private BigDecimal clauseMoney;

    @ApiModelProperty(value = "商户ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long customerId;

    @ApiModelProperty(value = "商户名称")
    private String customerName;

    @ApiModelProperty(value = "车次")
    private String trainNum;

    @ApiModelProperty(value = "订单时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd")
    private Date orderTime;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @ApiModelProperty(value = "包装成本-销售显示")
    private BigDecimal packageCostForSales = BigDecimal.ZERO;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @ApiModelProperty(value = "蔬菜成本-销售显示")
    private BigDecimal costWeightForSales = BigDecimal.ZERO;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @ApiModelProperty(value = "包装成本-销售显示")
    private BigDecimal packageCostToShow;

    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#0.00")
    @ApiModelProperty(value = "蔬菜成本-销售显示")
    private BigDecimal costWeightToShow;

    @ApiModelProperty("销售订单id")
    private Long salesOrderId;

    private String category;

    private List<SalesOrderDetailStock> shares = new ArrayList<>();

    @ApiModelProperty("扣款金额")
    private BigDecimal deductionMoney;
    @ApiModelProperty("回款金额")
    private BigDecimal receivedMoney;
    
    @ApiModelProperty(value = "业务员ID")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long salesmanId;
    
    @ApiModelProperty(value = "业务员姓名")
    private String salesmanName;
}